package cn.iocoder.yudao.module.system.controller.admin.merchant;

import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.system.controller.admin.merchant.vo.MerchantApplicationPageReqVO;
import cn.iocoder.yudao.module.system.controller.admin.merchant.vo.MerchantApplicationPageRespVO;
import cn.iocoder.yudao.module.system.controller.admin.merchant.vo.MerchantAuthUpdateReqVO;
import cn.iocoder.yudao.module.system.service.merchant.MerchantAuthService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;

/**
 * @author 梁富贵
 * @Date 2024/10/18
 **/
@Tag(name = "商户后台 - 商家申请管理")
@RestController
@RequestMapping("/merchant/application")
@Validated
public class MerchantApplicationController {


    @Resource
    private MerchantAuthService merchantAuthService;

    @Operation(summary = "分页查询商家认证信息")
    @GetMapping("/page")
    public CommonResult<PageResult<MerchantApplicationPageRespVO>> selectPage(MerchantApplicationPageReqVO reqVO) {
        return success(merchantAuthService.selectPage(reqVO));
    }

    @Operation(summary = "通过商家认证")
    @PostMapping("/passed")
    public CommonResult<Boolean> passedMerchantAuth(@RequestBody MerchantAuthUpdateReqVO reqVO) {
        return success(merchantAuthService.passedMerchantAuth(reqVO));
    }

    @Operation(summary = "驳回商家认证")
    @PutMapping("/reject")
    public CommonResult<Boolean> rejectMerchantAuth(@RequestBody MerchantAuthUpdateReqVO reqVO) {
        return success(merchantAuthService.rejectMerchantAuth(reqVO));
    }


}
